<template>
  <div>
    <h1>DEMO-1--{{ count }}</h1>
    <Child1View :title="title" :list="list" :age="age" :sex="sex" @myclick="myHandler1"></Child1View>
  </div>
</template>

<script>
import Child1View from './child/Child1.vue'

const Provider = {
  // provide: { goods: [123, 123123, 1231, 231233453, 4] },
  provide() {
    return {
      goods: this.goods
    }
  },
  methods: {
    fn2() {
      console.log('fn2')
    }
  },
  computed: {}
}
export default {
  name: 'DEMODemo1View',
  mixins: [Provider],
  data() {
    return {
      list: [1, 2, 3, 4],
      title: 'wqw',
      age: 22,
      sex: 1,
      count: undefined,
      goods: [123, 123123, 1231, 231233453, 4]
    }
  },
  created() {
    console.log('demo1')
  },
  // provide() {
  //   return {
  //     goods: this.goods
  //   }
  // },
  components: {
    Child1View
  },
  mounted() {
    console.log('demo1')
    // console.log(this)
    // this.fn2() // 调用混入的methods.
    console.log(this.$children[0].count)
    this.count = this.$children[0].count
  },
  methods: {
    myHandler1(v) {
      console.log('myHandler1', v)
    }
  }
}
</script>

<style lang="less" scoped></style>
